# 一些公用配置
import os

# APPLICATION_ROOT = "/api"
SECRET_KEY = "sdsjk1239jkfsd1029011sMjSH9"

# 数据库配置
hostName = "localhost"
port = 3306
userName = "root"
password = "123456"
dataBase = "book_system"
DB_URI = f"mysql+pymysql://{userName}:{password}@{hostName}:{port}/{dataBase}?charset=utf8"

SQLALCHEMY_DATABASE_URI = DB_URI
# 查询时会显示原始SQL语句
SQLALCHEMY_ECHO = True

# 文件上传配置
UPLOAD_FOLDER = 'static/uploads/'
# 静态文件上传端点，url_for()使用（固定值）
UPLOAD_ENDPOINT = 'static'
# 文件上传基础路径，上面端点后面的路径
UPLOAD_BASE_FOLDER = 'uploads'
# 文件类型
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
#  exist_ok=True防止目录存在而抛出异常，默认值False
os.makedirs(UPLOAD_FOLDER, exist_ok=True)

# session配置
PERMANENT_SESSION_LIFETIME = 60 * 60 * 24 * 30  # 30天
SESSION_COOKIE_SAMESITE = None
SESSION_COOKIE_SECURE = False  # 如果使用 HTTP，设为 False；如果使用 HTTPS，设为 True


